package com.shanghaionstar.user.presenter;

import com.onstar.cn.auth.CheckNewVersion;
import com.onstar.cn.common.util.DeviceUtil;

import com.onstar.cn.framework.mvp.base.IMVPScheduler;
import com.onstar.cn.framework.mvp.base.IMVPView;
import com.onstar.cn.framework.mvp.base.core.BasePresenter;
import com.onstar.cn.framework.utils.GsonHelper;
import com.shanghaionstar.R;
import com.shanghaionstar.report.bean.DynamicDTO;
import com.shanghaionstar.report.bean.ReportReqParam;
import com.shanghaionstar.report.model.ReportModel;
import com.shanghaionstar.user.iview.IAboutView;
import com.shanghaionstar.user.service.AboutService;
import com.shanghaionstar.utils.BusinessUtil;

/**
 * Created by 7828wc on 2016/6/29.
 */
public class AboutPresenter extends BasePresenter<CheckNewVersion> {
    private IAboutView aboutView;
    private AboutService aboutService;

    public AboutPresenter(IMVPScheduler mvpScheduler) {
        super(mvpScheduler);
    }

    @Override
    public void setView(IMVPView<CheckNewVersion> view) {
        super.setView(view);
        this.aboutView = (IAboutView) view;
        aboutService = new AboutService(view.onActivity());
        setServiceProvider(aboutService);
        init();
    }

    private void init() {
        String version = aboutView.onActivity().getString(R.string.onstar_app_name)+new DeviceUtil(aboutView.onActivity()).getAppVersion().replace(".A", "");
        aboutView.showVersion(version);
    }

    public void sendReport(String functionNameFindId) {
        BusinessUtil.sendReportByClickType(aboutView.onActivity(), functionNameFindId);
    }
}
